package com.lkc.utils.entity;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lkc.domain.entity.Exam;
import com.lkc.domain.entity.QuestionExam;
import com.lkc.domain.entity.UserExam;
import com.lkc.enums.SystemContains;
import com.lkc.service.QuestionExamService;
import com.lkc.service.UserExamService;
import com.lkc.utils.security.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @Title: QuestionUtils
 * @Author 椰咩咩
 * @Package com.lkc.utils.entity
 * @Date 2022/12/28 15:31
 * @description: 问题（question）的工具类
 */
@Component
public class QuestionUtils {

    @Autowired
    private static UserExamService userExamService;

    public static String getStatus(Exam exam) {

        Date now = new Date();
        if (exam.getStartTime().after(now)) {
            return SystemContains.EXAM_NOT_STARTED;
        } else if (exam.getEndTime().before(now)) {
            return SystemContains.EXAM_END;
        } else if (now.after(exam.getStartTime()) && now.before(exam.getEndTime())) {
            return SystemContains.EXAMINING;
        }
        return SystemContains.EXAM_UNKNOWN;
    }

}
